import request from '@/utils/request'

// 角色信息
export default{

  // 获取所有的分类信息
  getAllCategory(){
    return request({
      url:`/article/api/category/list`,
      method:'get'
    })
  },

  // 获取所有的标签信息
  getAllLabel(){
    return request({
      url:`/article/api/label/labelList`,
      method:'get'
    })
  },

  // 统计每个分类下的文章数
  getCategoryCount() {
    return request({
      url:`/article/api/category/categoryCount`,
      method:'get'
    })
  },

  // 根据文章id获取文章的标签和分类
  getCategoryAndLabelsByArticleId(id){
    return request({
      url:`/article/article/getCategoryAndLabelsByArticleId/${id}`,
      method:'get'
    })
  },

  // 根据标签id查询标签信息
  getLabelById(id){
    return request({
      url:`/article/api/label/info/${id}`,
      method:'get'
    })
  },

  // 根据分类信息的id查询标签信息
  getLabelByCategoryId(id){
    return request({
      url:`/article/label/getLabelByCategoryId/${id}`,
      method:'get'
    })
  },

  // 查询博客详情
  getById(id){
    return request({
      url:`/article/api/article/getById/${id}`,
      method:'get'
    })
  },

  // 根据分类id查询分类信息
  getCategoryById(id){
    return request({
      url:`/article/category/info/${id}`,
      method:'get'
    })
  },

  // 发布文章
  addArticle(data){
    return request({
      url:`/article/article/save`,
      method:'post',
      data
    })
  },

  // 添加分类
  addCategory(data){
    return request({
      url:`/article/category/save`,
      method:'post',
      data
    })
  },

  // 添加标签
  addLabel(data){
    return request({
      url:`/article/label/save`,
      method:'post',
      data
    })
  },

  // 编辑文章
  updateArticle(data){
    return request({
      url:`/article/article/update`,
      method:'put',
      data
    })
  },

  // 编辑标签
  updateLabel(data){
    return request({
      url:`/article/label/update`,
      method:'put',
      data
    })
  },

  // 条件分页查询文章列表
  queryArticleList(data){
    return request({
      url:`/article/api/article/list`,
      method:'post',
      data
    })
  },

  // 删除文章
  delete(id){
    return request({
      url:`/article/article/delete/${id}`,
      method:'delete'
    })
  },

  // 删除标签
  deleteLabel(id){
    return request({
      url:`/article/label/delete/${id}`,
      method:'delete'
    })
  },

  // 发布
  release(id){
    return request({
      url:`/article/article/release/${id}`,
      method:'put'
    })
  },

  // 删除分类
  deleteCategory(id){
    return request({
      url:`/article/category/delete/${id}`,
      method:'delete'
    })
  },

  // 编辑分类
  updateCategory(data){
    return request({
      url:`/article/category/update`,
      method:'put',
      data
    })
  },

  // 根据标签id查询标签信息
  getRecommend(){
    return request({
      url:`/article/api/article/getRecommend`,
      method:'get'
    })
  },

  // 获取文章的贡献度
  getContributeDate(){
    return request({
      url:`/article/api/category/getContributeDate`,
      method:'get'
    })
  },

  // 条件分页查询评论列表
  queryCommentList(data){
    return request({
      url:`/article/comment/comments`,
      method:'post',
      data
    })
  },

  // 删除评论
  deleteComment(id){
    return request({
      url:`/article/comment/delete/${id}`,
      method:'delete'
    })
  },

  // 条件分页查询留言列表
  queryMessageList(data) {
    return request({
      url:`/article/message/list`,
      method:'post',
      data
    })
  },

  // 删除留言
  deleteMessage(id) {
    return request({
      url:`/article/message/delete/${id}`,
      method:'delete'
    })
  },








}
